function autoSelect(itm, val){
	var o=$(itm);
	for (i=0;i<o.options.length;i++){
		if(o.options[i].value==val){
			o.selectedIndex = i;
			break;
		}
	}

}
function addoptions(obj,text,val){
	var o=$(obj);
	var opt = document.createElement('OPTION');
	opt.text = text;
	opt.value = val;
	o.options.add(opt, o.length);
}
var maxage=80;
function chgage(){
	var age_f=$("age_from");
	var age_t=$("age_to");
	var cur_t=age_t.value;
	if(age_f.value>=1){
        len = age_f.value;
	}else{  len=1;}

	age_t.length=1;
	for(i=len;i<=maxage;i++){
		addoptions('age_to',i,i);
	}       
	autoSelect('age_to',cur_t);
}

